<template>
	<view class="content">
		<view class="content_time">
			{{itemMap.datetime}}
		</view>
		<view class="content_item u-flex" :class="itemMap.self_side ? 'content_item--right' : 'content_item--left'">

			<u-image :class="itemMap.self_side ? 'u-m-l-26' : 'u-m-r-26'" :src="itemMap.avatar" :width="91.5"
				:height="91.5"  shape="circle"></u-image>

			<view class="position-box" @click="handlejumpLink">
				<view class="position-top u-white-60" v-if="itemMap.message">
					<view class="top-txt1 substring u-line-1">{{itemMap.message.title}}</view>
					<view class="top-txt2 substring u-line-1">{{itemMap.message.address}}</view>
				</view>
				<u-image src="/pages/pagesMessage/static/map.png" height="190" mode="heightFix"></u-image>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		watch
	} from 'vue'
	const itemMap = ref({})
	const props = defineProps({
		itemMap: Object
	})
	watch(()=>props.itemMap,(nv)=>{
		itemMap.value = nv
	},{
		immediate:true,
		deep:true
	})
	const handlejumpLink = () => {
		uni.openLocation({
			latitude: Number(itemMap.value.message.lat),
			longitude: Number(itemMap.value.message.lon)
		});
	}
</script>

<style lang="scss" scoped>
	.content {
		margin-bottom: 60rpx;

		&_time {
			text-align: center;
			margin: 46rpx 0 28rpx 0;
			color: #999999;
			font-size: 24rpx;
		}

		&_item--left {
			flex-direction: row;
			margin-left: 30rpx;
		}

		&_item--right {
			flex-direction: row-reverse;
			margin-right: 30rpx;
		}

		&_item {
			font-size: 28rpx;
			height: 100%;
			margin-bottom: 60rpx;
		}

	}

	// 发送位置开始
	.position-box {
		background: #FFFFFF;
		border: 2rpx solid #FFFFFF;
		border-radius: 20rpx 0px 20rpx 20rpx;

		.position-top {
			padding: 30rpx 44rpx 26rpx 22rpx;

			.top-txt1 {
				color: #333333;
				font-size: 26rpx;
				margin-bottom: 6rpx;
				font-weight: 500;
			}

			.top-txt2 {
				color: #999999;
				font-size: 24rpx;
			}
		}
	}
</style>